<template>
    <div>
        <div style="margin-top: 1%">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item >首页</el-breadcrumb-item>
                <el-breadcrumb-item>采购合同</el-breadcrumb-item>
                <el-breadcrumb-item>新增</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
        <el-form :model="form" :rules="rules" ref="ruleform" label-width="140px">
            <el-row>
                <el-col :span="12">
                    <el-form-item label="付款条件"  prop="fktj">
                        <el-input v-model="form.fktj" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="合同状态"  prop="htzt" >
                        <el-input v-model="form.htzt" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="合同号"  prop="hth">
                        <el-input v-model="form.hth" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="币别"  prop="bibie" >
                        <el-input v-model="form.bibie" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="核算项目类别"  prop="hsxmlx">
                        <el-input  v-model="form.hsxmlx" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="核算项目代码"  prop="hsxmdm">
                        <el-input  v-model="form.hsxmdm" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="核算项目"  prop="hsxm">
                        <el-input  v-model="form.hsxm" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="部门代码"  prop="bmdm">
                        <el-input  v-model="form.bmdm" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="部门"  prop="bumen">
                        <el-input v-model="form.bumen" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="业务员代码"  prop="ywydm">
                        <el-input  v-model="form.ywydm" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="业务员"  prop="ywy">
                        <el-input v-model="form.ywy" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="总金额"  prop="zje">
                        <el-input type="number" v-model="form.zje" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="审核人"  prop="shr">
                        <el-input  v-model="form.shr" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
                <el-col :span="12">
                    <el-form-item label="应付日期"  prop="yfrq">
                        <el-input  v-model="form.yfrq" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-form-item label="应付金额"  prop="yfje">
                        <el-input  v-model="form.yfje" autocomplete="off"></el-input>
                    </el-form-item>
                </el-col>
            </el-row>
        </el-form>
        <div slot="footer" class="dialog-footer">
            <el-button @click="resetForm">重 置</el-button>
            <el-button type="primary" @click="handleConfine">确 定</el-button>
        </div>
    </div>
</template>

<script>
  export default {
    name: 'index',
    data(){
      return{
        form:  {
          id:1,
          fktj: '',
          htzt: '',
          htrq: '',
          hth: '',
          bibie: '',
          hsxmlx: '',
          hsxmdm: '',
          hsxm: '',
          bmdm: '',
          bumen: '',
          ywydm: '',
          ywy: '',
          zje: '',
          shr: '',
          yfrq: '',
          yfje: '',
        },
        labelWidth:'100px',
        rules: {
          fktj: [
            { required: true, message: '付款条件', trigger: 'blur' },
          ],
          htzt: [
            { required: true, message: '合同状态', trigger: 'blur' },
          ],
          hth: [
            { required: true, message: '合同号', trigger: 'blur' },
          ],
          bibie: [
            { required: true, message: '币别', trigger: 'blur' },
          ],
          hsxmlx: [
            { required: true, message: '核算项目类别', trigger: 'blur' },
          ],hsxmdm: [
            { required: true, message: '核算项目代码', trigger: 'blur' },
          ],hsxm: [
            { required: true, message: '核算项目', trigger: 'blur' },
          ],bmdm: [
            { required: true, message: '部门代码', trigger: 'blur' },
          ],bumen: [
            { required: true, message: '部门', trigger: 'blur' },
          ],ywydm: [
            { required: true, message: '业务员代码', trigger: 'blur' },
          ],ywy: [
            { required: true, message: '业务员', trigger: 'blur' },
          ],zje: [
            { required: true, message: '总金额', trigger: 'blur' },
          ],shr: [
            { required: true, message: '审核人', trigger: 'blur' },
          ],yfrq: [
            { required: true, message: '应付日期', trigger: 'blur' },
          ],yfje: [
            { required: true, message: '应付金额', trigger: 'blur' },
          ],
        }
      }
    },
    methods:{
      //确认添加
      handleConfine() {
        var validate = false;
        this.$refs['ruleform'].validate((valid) => {
          if (valid) {
            validate = true;
          } else {
            console.log('error submit!!');
            validate = false;
            return false;
          }
        });
        if (validate === false) {
          return;
        }
        setTimeout(()=>{
          this.form.id = Math.ceil(Math.random()*100);
          // this.tableData.push(this.form);
          // this.$store.commit('addSkuDatas',this.form)
          this.addcangkuDatas(this.form)
        },2000)
        this.showAddDialog = false;
        this.$message.success("添加成功!");

      },
      resetForm() {
        this.$refs['ruleform'].resetFields();
      },
    }
  };
</script>

<style scoped>

</style>
